package com.mango.facade;


import com.mango.facade.common.result.ResultModel;
import com.mango.facade.common.util.ResultUtil;
import com.mango.facade.param.Category;
import com.mango.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/category")
public class CategoryController {

    @Autowired
    private CategoryService categoryService;


    @GetMapping(value = "/get")
    public ResultModel<List<Category>> getCategoryList(@RequestParam String categoryParentId) {
        //为空设置父ID
        List<Category> categoryList = categoryService.getCategoryList(categoryParentId);
        return ResultUtil.success(categoryList);
    }


}
